package com.mopoba.app;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;
import android.widget.ListAdapter;

import com.mrpoid.shequ2.R;


/**
 * 宫格页基类
 * 
 * @author Yichou
 *
 */
public abstract class BaseGridFragment extends Fragment implements OnItemClickListener {
	GridView mGridView;
	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View v = inflater.inflate(R.layout.fragment_pager_grid, null);
		
		mGridView = (GridView) v.findViewById(R.id.gridView1);
		mGridView.setAdapter(onCreateAdapter());
		mGridView.setOnItemClickListener(this);
		
		return v;
	}
	
	protected abstract ListAdapter onCreateAdapter();
}